package com.bdqn.Di1Zhan;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * 第一章实例3
 */
public class PersonInvoke {

    public static void main(String[] args) {
        try {
           Class clz = Class.forName("com.bdqn.Di1Zhan.entity.Person");

           Object person = clz.newInstance();

            Method silentMethod = clz.getDeclaredMethod("silentMethod" , null);

            silentMethod.setAccessible(true);

            silentMethod.invoke(person, null);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        }
    }
}
